home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / public / ghostscript / src / gstypes.h < prev    next >
C/C++ Source or Header  |  1994-08-01  |  3KB  |  70 lines

  1. /* Copyright (C) 1989, 1990, 1993 Aladdin Enterprises.  All rights reserved.
  2.  
  3. This file is part of Ghostscript.
  4.  
  5. Ghostscript is distributed in the hope that it will be useful, but
  6. WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  7. to anyone for the consequences of using it or for whether it serves any
  8. particular purpose or works at all, unless he says so in writing.  Refer
  9. to the Ghostscript General Public License for full details.
  10.  
  11. Everyone is granted permission to copy, modify and redistribute
  12. Ghostscript, but only under the conditions described in the Ghostscript
  13. General Public License.  A copy of this license is supposed to have been
  14. given to you along with Ghostscript so you can know your rights and
  15. responsibilities.  It should be in a file named COPYING.  Among other
  16. things, the copyright notice and this notice must be preserved on all
  17. copies.  */
  18.  
  19. /* gstypes.h */
  20. /* Miscellaneous common types for Ghostscript library */
  21.  
  22. /* Representation of a point. */
  23. typedef struct gs_point_s {
  24.     double x, y;
  25. } gs_point;
  26. typedef struct gs_int_point_s {
  27.     int x, y;
  28. } gs_int_point;
  29. /* Representation of a rectangle. */
  30. /* Note that rectangles are half-open, i.e.: their width is */
  31. /* q.x-p.x and their height is q.y-p.y; they include the points */
  32. /* (x,y) such that p.x<=x<q.x and p.y<=y<q.y. */
  33. typedef struct gs_rect_s {
  34.     gs_point p, q;            /* origin point, corner point */
  35. } gs_rect;
  36. typedef struct gs_int_rect_s {
  37.     gs_int_point p, q;
  38. } gs_int_rect;
  39.  
  40. /* So many routines use the graphics state */
  41. /* that we may as well declare the abstract type here. */
  42. struct gs_state_s;
  43. typedef struct gs_state_s gs_state;
  44.  
  45. /*
  46.  * Types for client-supplied allocate and free procedures.
  47.  * For accountability, debugging, and error messages,
  48.  * we pass an identifying string to alloc and free.
  49.  * Note that the arguments are like calloc, not like malloc,
  50.  * but an alloc procedure doesn't clear the block.
  51.  */
  52. typedef char *(*gs_proc_alloc_t)(P3(unsigned num_elements, unsigned element_size, const char *client_name));
  53. typedef void (*gs_proc_free_t)(P4(char *data, unsigned num_elements, unsigned element_size, const char *client_name));
  54. /*
  55.  * These procedures are never supplied directly, only as elements of
  56.  * a memory_procs structure.  Someday the memory manager will be a real
  57.  * 'object'....
  58.  */
  59. typedef struct {
  60.     gs_proc_alloc_t alloc;
  61.     gs_proc_free_t free;
  62. } gs_memory_procs;
  63. /*
  64.  * We define our own versions of malloc and free that conform
  65.  * to the types gs_proc_alloc_t and gs_proc_free_t:
  66.  */
  67. char *gs_malloc(P3(uint, uint, const char *));
  68. void gs_free(P4(char *, uint, uint, const char *));
  69. extern const gs_memory_procs gs_default_memory_procs;
  70.